<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'My Web Application',

	
	'preload'=>array(
		'log', // preloading 'log' component
		'bootstrap', // preload the bootstrap component
	),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'application.controllers.*',
		'application.modules.user.models.*',
        'application.modules.user.components.*',
		'application.modules.poll.models.*',
		'application.modules.poll.components.*',
		'application.modules.message.controllers.*',
	),

	'modules'=>array(
	
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'admin',
		 	// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
			'generatorPaths'=>array(
            'bootstrap.gii',
        ),
		),
		'user'=>array(
                # encrypting method (php hash function)
                'hash' => 'md5',
                # send activation email
                'sendActivationMail' => true,
                # allow access for non-activated users
                'loginNotActiv' => false,
                # activate user on registration (only sendActivationMail = false)
                'activeAfterRegister' => false,
                # automatically login from registration
                'autoLogin' => true,
                # registration path
                'registrationUrl' => array('/user/registration'),
                # recovery password path
                'recoveryUrl' => array('/user/recovery'),
                # login form path
                'loginUrl' => array('/user/login'),
                # page after login
                'returnUrl' => array('/user/profile'),
                # page after logout
                'returnLogoutUrl' => array('/user/login'),
            ),
		'message' => array(
				'userModel' => 'User',
				'getNameMethod' => 'getFullName',
				'getSuggestMethod' => 'getSuggest',
				//'viewPath' => '//fancy',
			),	

		'poll' => array(
			   // Force users to vote before seeing results
			   'forceVote' => TRUE,
			   // Restrict anonymous votes by IP address,
			   // otherwise it's tied only to user_id 
			   'ipRestrict' => TRUE,
			   // Allow guests to cancel their votes
			   // if ipRestrict is enabled
			   'allowGuestCancel' => FALSE,
		 ),
		  'comments'=>array(
			//you may override default config for all connecting models
			'defaultModelConfig' => array(
				//only registered users can post comments
				'registeredOnly' => false,
				'useCaptcha' => false,
				//allow comment tree
				'allowSubcommenting' => true,
				//display comments after moderation
				'premoderate' => false,
				//action for postig comment
				'postCommentAction' => 'comments/comment/postComment',
				//super user condition(display comment list in admin view and automoderate comments)
				'isSuperuser'=>'Yii::app()->user->checkAccess("moderate")',
				//order direction for comments
				'orderComments'=>'DESC',
			),
			//the models for commenting
			'commentableModels'=>array(
				//model with individual settings
				'Creatives'=>array(
					'registeredOnly'=>true,
					'useCaptcha'=>false,
					'allowSubcommenting'=>false,
					//config for create link to view model page(page with comments)
					'pageUrl'=>array(
						'route'=>'admin/creatives/view',
						'data'=>array('id'=>'id'),
					),
				),
				//model with default settings
				'ImpressionSet',
			),
			//config for user models, which is used in application
			'userConfig'=>array(
				'class'=>'User',
				'nameProperty'=>'username',
				'emailProperty'=>'email',
			),
		),
	),

	// application components
	'components'=>array(
	
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=testdrive2',
			'emulatePrepare' => true,
			'tablePrefix' => '',
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
		),
		
		'user'=>array(
                // enable cookie-based authentication
                'class' => 'WebUser',
                'allowAutoLogin'=>true,
                'loginUrl' => array('/user/login'),
            ),

		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
		'bootstrap'=>array(
			'class'=>'ext.bootstrap.components.Bootstrap',
		),
		
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);